package Package1;
//import java.util.Scanner;
//public class Test3 {
//    public static void main(String args[]) {
//
//        Scanner sc = new Scanner(System.in);
//        String str = sc.nextLine();
//        StringBuffer sb = new StringBuffer();
//        String s1 = null;
//
//        for (int i = str.length() - 1; i >= 0; i--) {
//            char curChar = str.charAt(i);
//            if (curChar >= 'a' && curChar <= 'z')
//                s1 = String.valueOf((char)(curChar-32));
//            else if (curChar >= 'A' && curChar <= 'Z')
//                s1 = String.valueOf((char)(curChar+32));
//            else
//                s1 = String.valueOf(curChar);
//            sb.append(s1);
//        }
//
//        System.out.println(sb.toString());
//    }
//}

import java.util.Scanner;
//矩阵相加 C = A + B //写出方法调用
public class Test3 {
    public static int n,m;
    public static Scanner scan = new Scanner(System.in);
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        n = scan.nextInt();//矩阵的行
        m = scan.nextInt();//矩阵的列
        //创建二维数组a  行m，列n
        int[][] a=new int[][]{{1,2,3},{4,5,6},{7,8,9}};
        //调用方法 为a输入数据
        inputData(a);
        //创建二维数组b 行m，列n
        int[][] b=new int[100][100];

        //调用方法，为b输入数据
        inputData(b);

        //调用方法 求 a+b


        //输出结果
        showResult(addMatrix(a,b));
    }
    public static void inputData(int[][] arr){
        for(int i =0;i<n;i++)
            for(int j=0;j<m;j++)
                arr[i][j] =scan.nextInt();
    }
    public static int[][] addMatrix(int[][]arr1,int[][]arr2){
        int [][] c = new int[n][m];
        for(int i =0;i<n;i++)
            for(int j =0;j<m;j++)
                c[i][j] = arr1[i][j] + arr2[i][j];
        return c;
    }
    public static void showResult(int[][] arr){
        for(int i =0;i<n;i++){
            for(int j =0;j<m;j++)
                System.out.print(" "+arr[i][j]);
            System.out.println();
        }
    }
}
